home *** CD-ROM | disk | FTP | other *** search
/ CD School House 9 / CD School House 9.0 - Wayzata Technology (1994).iso / pc / games / mac / __the_arcade__ / sea_hunt / stack.txt < prev   
Text File  |  1990-09-08  |  9KB  |  325 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 2
  11. -- first background id: 2774
  12. -- card count: 16
  13. -- first card id: 5444
  14. -- list block id: 12172
  15. -- print block id: 3518
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 2
  19. -- free size: 23520 bytes
  20. -- total size: 172032 bytes
  21. -- stack block size: 7680 bytes
  22. -- created by hypercard version: 0x01228000
  23. -- compacted by hypercard version: 0x01228000
  24. -- modified by hypercard version: 0x01228000
  25. -- opened by hypercard version: 0x01258000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xF0F0F0F00F0F0F0F
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. --
  69. --
  70. --   This stack and it's scripts and graphics are copyright 1989,
  71. --   Prophecy Software Inc.  All rights reserved.
  72. --
  73. --   You may examine this code for your own benifit.
  74. --   If you wish to make changes that enhance the stack please make
  75. --   them to a copy and contact us at:
  76. --
  77. --   Prophecy Software Inc.
  78. --   3650 Silverside Rd. Suite 3
  79. --   Wilmington, DE 19810
  80. --   (302) 994-1502
  81. --
  82. --   We will be happy to consider distributing an updated version with
  83. --   propper credit given to the author.  distribution of copies of this
  84. --   stack with un-authorized alterations constitures copyright
  85. --   violation and fraud.
  86.  
  87. on idle
  88.   global my_choice, last_message, hit_count
  89.   global bs, su, tt, pt, ca
  90.  
  91.   put read_message() into the_message
  92.  
  93.   if the_message is empty then exit idle
  94.  
  95.   if offset(numtochar(5), the_message) is not 0 then
  96.     get send_message(last_message && "ΓÇó")
  97.     exit idle
  98.   end if
  99.  
  100.   -- test for read of entire the_message
  101.  
  102.   put the number of chars in the_message into the_length
  103.  
  104.   if char the_length of the_message is not "ΓÇó" then
  105.     get  send_message(numtochar(5))
  106.     exit idle
  107.   end if
  108.  
  109.   put word 1 of the_message into command
  110.  
  111.   -- move, query to ship at this location
  112.  
  113.   if command is "move" then
  114.     put "Incoming..." into card field 1 of card "enemy board"
  115.     put word 2 of the_message into value
  116.     put field value of card "player board" into the_letter
  117.     put "re" && value && the_letter into last_message
  118.     if the_letter is not "" then
  119.       go to card "player Card"
  120.       play boom
  121.       set icon of button value  to 7009
  122.       get flash("Hit")
  123.     else
  124.       go to card "player Card"
  125.       play splash
  126.       set icon of button value  to 19123
  127.       get flash ("Miss")
  128.     end if
  129.     get  send_message ("re" && value && the_letter && "ΓÇó")
  130.     exit idle
  131.   end if
  132.  
  133.  
  134.   -- results, answer to a move query
  135.  
  136.   if command is "re" then
  137.     put word 2 of the_message into value
  138.     put word 3 of the_message into shot
  139.  
  140.     if shot is not "ΓÇó" then
  141.       put "Tower Reports Hit..." into card field 1 of card "enemy board"
  142.       play boom
  143.       set icon of button value of card "enemy board" to 7009
  144.  
  145.       if shot is "B" then
  146.         add 1 to bs
  147.         if bs is 5 then set hilite of card button bas of card "enemy board" to true
  148.       end if
  149.  
  150.       if shot is "C" then
  151.         add 1 to ca
  152.         if ca is 4 then set hilite of card button car of card "enemy board" to true
  153.       end if
  154.  
  155.       if shot is "T" then
  156.         add 1 to tt
  157.         if tt is 3 then set hilite of card button ttr of card "enemy board" to true
  158.       end if
  159.  
  160.       if shot is "S" then
  161.         add 1 to su
  162.         if su is 3 then set hilite of card button sub of card "enemy board" to true
  163.       end if
  164.  
  165.       if shot is "P" then
  166.         add 1 to pt
  167.         if pt is 2 then set hilite of card button ptb of card "enemy board" to true
  168.       end if
  169.  
  170.       add 1 to hit_count
  171.       if hit_count is 17  then
  172.         get  send_message("win" && "ΓÇó")
  173.         put "win" into last_message
  174.         put "The Enemy is Defeated!" & return & "---Game Over---" into card field 1 of card "enemy board"
  175.         go to card "enemy board"
  176.       end if
  177.  
  178.     else
  179.       put "Tower Reports Miss..." into card field 1 of card "enemy board"
  180.       play splash
  181.       set icon of button value of card "enemy board" to 19123
  182.     end if
  183.     get  send_message("go" && "ΓÇó")
  184.     put "go" into last_message
  185.     exit idle
  186.   end if
  187.  
  188.   if command is "sm" then
  189.     put the number of words in the_message into count
  190.     subtract 1 from count
  191.     put word 2 to count of the_message into the_message
  192.     put the_message into card field 1 of card "enemy board"
  193.     exit idle
  194.   end if
  195.  
  196.   if command is "go" then
  197.     show button 65 of card "enemy board"
  198.     go to card "enemy board"
  199.     put "Your Move" & numtochar(13) into card field 1 of card "enemy board"
  200.     put "Press on Tile to Fire" after  card field 1 of card "enemy board"
  201.     exit idle
  202.   end if
  203.  
  204.   -- start determine who goes first
  205.  
  206.   if command is "st" then
  207.     put word 2 of the_message into value
  208.     if my_choice > value then
  209.       show button 65 of card "enemy board"
  210.       put "Your Move" into card field 1 of card "enemy board"
  211.     else if my_choice < value then
  212.       get  send_message("go" && "ΓÇó")  -- other player goes first
  213.       put "go" into last_message
  214.       hide button 65 of card "enemy board"
  215.       put "Please Wait..." into card field 1 of card "enemy board"
  216.     end if
  217.     exit idle
  218.   end if
  219.  
  220.   if command is "win" then
  221.     go to card "enemy board"
  222.     put "You Lose" into card field 1 of card "enemy board"
  223.     play trumpet g3 g c4w  g3q c4 ew  g3q c4 g4h eh c  g3 g c4w
  224.     exit idle
  225.   end if
  226.  
  227.   if command is "done" then
  228.     show card field 1 of card "player board"
  229.     exit idle
  230.   end if
  231.  
  232.   if command is "at" then
  233.     put word 2 of the_message into value
  234.     get icon of button value of card "enemy board"
  235.     if it is 0 then
  236.       set icon of button value of card "enemy board" to 30874
  237.     end if
  238.     exit idle
  239.   end if
  240.  
  241.  
  242.   -- unknown command, send query
  243.   get readmodem()
  244.   get  send_message(numtochar(5))
  245. end idle
  246.  
  247. on OpenStack
  248.   global my_choice, whom
  249.  
  250.   put random(10) into my_choice
  251.   get openmodem()
  252.   get resetmodem(1200, 8, "n", 1)
  253.   put "" into card field "message" of card "computer card"
  254.   put empty into whom
  255. end OpenStack
  256.  
  257.  
  258. function read_message
  259. global opponent
  260. if opponent is "computer" then
  261.   get card field "message" of card "computer Card"
  262.   put "" into card field "message" of card "computer card"
  263.   return it
  264. else
  265.   get readmodem()
  266.   if it is 0 then return empty
  267.  
  268.   put it into the_message
  269.   get readmodem()
  270.   if it is not 0 then put the_message & it into the_message
  271.  
  272.  
  273.   -- if the computer is playing agains the other machine for us
  274.   -- then we must reverse the roll of this routine. i.e. read data
  275.   -- goes to the computer not the player.
  276.   --
  277.   if opponent is "CVSC" then
  278.     put the_message into card field "data" of card "computer card"
  279.  
  280.     send com_turn to card "computer card"
  281.     return empty
  282.   end if
  283.  
  284.   return the_message
  285. end if
  286. return empty
  287.  
  288. end read_message
  289.  
  290.  
  291.  
  292. function send_message the_message
  293. global opponent
  294. if opponent is not "computer" then
  295.   get writemodem(the_message)
  296.  
  297.   if opponent is "CVSC" then
  298.     send com_turn to card "computer card"
  299.   end if
  300.  
  301.   exit send_message
  302. end if
  303.  
  304. -- computers turn here
  305. put the_message into card field "data" of card "computer card"
  306.  
  307. send com_turn to card "computer card"
  308. end send_message
  309.  
  310.  
  311. function flash the_words
  312. put 1 into count
  313. repeat while count < 5
  314.   put "" into card field 65 of card "Player card"
  315.   wait 5 ticks
  316.   put the_words into card field 65 of card "player card"
  317.   add 1 to count
  318.   wait 5 ticks
  319. end repeat
  320. put "" into card field 65 of card "Player card"
  321. end flash
  322.  
  323.  
  324.  
  325.